<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>资讯列表</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name=”apple-mobile-web-app-status-bar-style” content=”default”/>
    <meta name=”apple-mobile-web-app-status-bar-style” content=”black”/>
    <meta name=”apple-mobile-web-app-status-bar-style” content=”black-translucent”/>
    <meta content="telephone=no" name="format-detection">
    <meta content="email=no" name="format-detection">
    <meta name="format-detection" content="telephone=no"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link href="${s.base}/pc/css/swiper.min.css" rel="stylesheet">
    <link href="${s.base}/pc/css/weWeb.css" rel="stylesheet"/>
</head>
<body>
<div class="w1200 we-head clearfix">
    <div class="we-head-logo"><img src="/sysFile/showFileByPath?path=${websiteConfiguration.logoPath}"></div>
    <div class="we-head-nav">
        <ul>
            <li class="checked" onclick="goFistPage()">首页</li>
            <li onclick="goCaseListPage()">案例</li>
            <li onclick="goProductListPage()">应用中心</li>
            <li onclick="goAboutUsPage()">关于我们</li>
            <#if sysUser?? >
            <li onclick="goMyIndexPage()">控制中心</li>
            </#if>
        </ul>
    </div>
    <#if sysUser?? >
    <div class="we-head-logined">
        <div class="user-updown ellipsis"><i class="cytfonts">&#xe6a2;</i></div>
        <div class="user-name ellipsis">${sysUser.name}</div>
        <div class="user-Avatar"><img src="/sysFile/showFileByObjectId?objectId=${sysUser.headLogo}"></div>
        <div class="user-txt-list" style="display:none;">
            <ul>
                <li>个人中心</li>
                <li>退出</li>
            </ul>
        </div>
    </div>
    <#else>
    <div class="we-head-loginbtn">
        <span><a href="/login">登录</a></span>
    </div>
</#if>
</div>
<div class="we-banner">
    <!-- Swiper -->
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <#if bannerList?? && (bannerList?size > 0) >
            <#list bannerList as p>
            <#if p.url?? && p.url!="">
                <div onClick="goBannerUrl('${p.url}')" class="swiper-slide" style="background: url(/sysFile/showFileByPath?path=${p.path}) top center no-repeat;background-size:auto 100%;"></div>
                <#else>
                <div class="swiper-slide" style="background: url(/sysFile/showFileByPath?path=${p.path}) top center no-repeat;background-size:auto 100%;"></div>
            </#if>
            </#list>
            <#else>
            <div class="swiper-slide" style="background: url(${s.base}/pc/images/banner.png) top center no-repeat;background-size:auto 100%;"></div>
            </#if>
        </div>
        <!-- Add Pagination -->
        <div class="swiper-pagination"></div>
        <!-- Add Arrows -->
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
    </div>
</div>
<div class="noticeList-ctn clearfix">
    <div class="menu-list-left">
        <div class="notice-tit"><i class="cytfonts">&#xe64e;</i><span>系统公告</span></div>
        <div class="notice-menu">
            <ul>
                <li class="checked" data-id="">全部</li>
                <#list sysDictContentList as sysDictContent>
                <li data-id="${sysDictContent.value}">${sysDictContent.name}</li>
                </#list>
            </ul>
        </div>
    </div>
    <div class="notice-list-right" >
        <div id="showList" style="display: none">
            <div class="new-list">
                <ul >

                </ul>
            </div>
        </div>

        <div id="showDetail" style="display: none">
            <#if websiteNews??>
            <div class="new-list">
                <div class="newstit">${websiteNews.name}</div>
                <div class="newstit-label">
                    <span>发布时间：${websiteNews.createTime?string('yyyy-MM-dd hh:mm:ss')}</span>
                </div>
                <div class="newsDetails">${websiteNews.content}</div>
            </div>
            </#if>
        </div>

        <div class="page-ctn clearfix" id="pageShow" style="display: none">
            <div class="zg-data" id="pageNum">总共0条数据</div>
            <div class="page" id="Page"></div>
        </div>
    </div>
</body>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/pc/js/jquery-2.1.4.min.js" type="text/javascript"></script>
<script src="${s.base}/pc/js/swiper.min.js" type="text/x-javascript"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/pc/js/MyPage.js" type="text/javascript" ></script>
<script src="${s.base}/pc/js/common.js" type="text/x-javascript"></script>
<script src="${s.base}/pc/js/base.js" type="text/x-javascript"></script>
<script>
    var code = "";
    var id = "${id}";

    layui.use(['jquery', 'dialog', 'baseutil'], function () {
        var $ = layui.jquery,
            dialog = layui.dialog,
            baseutil = layui.baseutil;

        $('.user-txt-list li').bind('click', function () {
            if ($(this).index() === 0) {
                window.open('/web/personalEdit', '_self')
            } else if ($(this).index() === 1) {
                dialog.confirm("确定要退出吗？", function () {
                    baseutil.AjaxGetMark("/webExit", "", function () {
                        window.location.href = "/web/index";
                    });
                });
            }
        });
    });

    $(function () {
        // pageNum();
        var swiper = new Swiper('.swiper-container', {
            slidesPerView: 1,
            spaceBetween: 0,
            loop: true,
            autoplay: true,
            pagination: {
                el: '.swiper-pagination',
                clickable: true,
            },
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },
        });
        $(".we-head-nav ul li").bind("click", function () {
            $(".we-head-nav ul li").removeClass("checked");
            $(this).addClass("checked");
        })
        $(".caseList-ctn ul li").hover(function () {
            $(".hover-erm-view").hide();
            $(this).find(".hover-erm-view").show();
        })

        $(".notice-menu ul li").hover(function () {
            $(".notice-menu ul li").removeClass("checked");
            $(this).addClass("checked");
        })

        if (!$(".new-list ul li").hasClass("new-have-pic")) {
            $(".newspic").hide();
        }

        $(".notice-menu ul li").bind("click", function () {
            $(".notice-menu ul li").removeClass("checked");
            $(this).addClass("checked");
            code = $(this).attr("data-id");
            initPage();
        });

        if (!id) {
            $("#showDetail").hide();
            $("#showList").show();
            $("#pageShow").show();
            initPage();
        } else {
            $("#showList").hide();
            $("#pageShow").hide();
            $("#showDetail").show();
        }

        $(".we-head-logined").mouseover(function(){
            $(".user-txt-list").show();
            $(this).find(".user-updown").addClass("Rotate180")
        });

        $(".we-head-logined").mouseout(function(){
            $(".user-txt-list").hide();
            $(this).find(".user-updown").removeClass("Rotate180")
        });
    });

    function initPage(){
        P.initMathod({
            params: {elemId: '#Page',total:'0',pageSize:'10'},
            requestFunction: function () {
                var pageSize =  P.config.pageSize;
                var pageNum =  P.config.pageIndex;
                $("#showDetail").hide();
                $("#showList").show();
                $.ajaxSettings.async = false;
                $.post("/web/websitenews/page",{
                    pageSize : pageSize,
                    pageNum : pageNum,
                    code : code
                },function(resultInfo){
                    // 查看数目,放在时间后面，<i class="cytfonts">&#xe646;</i><span>1236</span>
                    var str = '<div class="new-list"><ul id="showList">';
                    P.config.total = resultInfo.count;
                    if (resultInfo.data != null && resultInfo.data.length > 0){
                        $("#Page").show();
                        for(var j = 0; j<resultInfo.data.length; j++){
                            var news = resultInfo.data[j];
                            $("#pageNum").html("总共"+resultInfo.count+"条数据");
                            str += '<li class="new-have-pic" onclick="newsDetails(\''+news.id+'\')">\
                                <div class="newspic" style="background: url(/sysFile/showFileByPath?path='+news.path+') top center no-repeat;background-size:cover;"></div>\
                                <h1 class="ellipsis">'+news.name+'</h1>\
                                <p class="ellipsis2">'+news.description+'</p>\
                                <div class="date-time-line"><span>发布时间：'+new Date(news.createTime).Format("yyyy-MM-dd")+'</span></div>\
                            </li>';
                        }

                    } else {
                        $("#pageNum").html("总共0条数据");
                        $("#Page").hide();
                    }
                    str += '</ul></div>';
                    $("#pageShow").show();
                    $("#showList").html(str);
                },"json");
                $.ajaxSettings.async = true;
                // console.log(JSON.stringify(P.config));
            }
        });
    }

    function newsDetails(id){
        $.post("/web/websitenews/getById",{id:id},function(resultInfo){
            var str = '';
            if (resultInfo.data != null){
                var news = resultInfo.data;
                str += '<div class="new-list">\
                    <div class="newstit">'+news.name+'</div>\
                    <div class="newstit-label">\
                    <span>发布时间：'+new Date(news.createTime).Format("yyyy-MM-dd")+'</span>\
                </div>\
                <div class="newsDetails">'+news.content+'</div>\
                    </diiv>\
                    </div>';
            }
            $("#pageShow").hide();
            $("#showList").hide();
            $("#showDetail").show();
            $("#showDetail").html(str);
        },"json");
    }
</script>
</html>
